package design.prototype;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 浅拷贝
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Cell implements Cloneable {
    private String name;

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }

    public static void main(String[] args) throws CloneNotSupportedException {
        Cell cell = new Cell();
        cell.setName("红细胞");
        Cell cell1 = (Cell) cell.clone();
        System.out.println(cell1.getName());
        System.out.println(cell==cell1);
    }

}
